<?php
$params = $_ps = array();
foreach((array) system_controller_front::getInstance()->getRequest()->getParams() AS $key => $value) {
	if($key == 'controller') $key = 'category';
	$params[$key] = $value;
	$_ps[] = "$key=$value";
}
$_query = array('id' => 'commentMain', 'url' => (string) $this->url('ajax/comment'), 'params' => implode('&', $_ps));
$this->headLink()->prependStylesheet(_STATIC_HTTP . '/www/css/comment.css');
$this->headScript()->appendFile(_STATIC_HTTP . '/www/js/comment.js?' . http_build_query($_query));
?>
<?php $this->headScript()->captureStart();?>
$(document).ready(function(){
	$('#commentButton').click(function(){
		return comment.post($(this));
	});
	comment.load(1, true);
	$('#commentForm').keydown(function(e){comment.keydown(e);});
});
<?php $this->headScript()->captureEnd();?>
<?php echo '<a name="comment"></a>' . "\n";?>
<div id="commentMain">
	<div class="loading"><?php echo $this->language('正在加载评论，请稍后');?> ...</div>
</div>
<form method="post" action="<?php echo $this->url('ajax/comment');?>">
<?php
foreach($params AS $key => $value) {
	echo $this->form()->hidden($key, $value);
}
echo $this->form()->hidden('submit', 'submit');
echo $this->form()->hidden('reply_id', 0) . "\n";
?>
<div id="commentForm" class="o7">
	<h3 class="title">
		<span><?php echo $this->language('发表评论');?></span>
		<code>
		<?php if(!$this->user) { ?>
		<a href="<?php echo $this->url('account/login');?>"><?php echo $this->language('登录');?></a> - <a href="<?php echo $this->url('account/signup');?>"><?php echo $this->language('注册');?></a>
		<?php } else { ?>
		<a href="<?php echo $this->url('account/login');?>"><?php echo $this->language('换个帐号');?></a>
		<?php } ?>
		</code>
	</h3>
	<p class="gray"><?php echo $this->language('文明上网，理性发贴！')?></p>
	<ul>
		<li class="author">
			<?php if($this->user) { ?>
			<label for="author"><?php echo $this->language('帐号')?></label>
			<span><?php echo $this->user->getNickname(); ?></span> |
			<a href="<?php echo $this->url('account/login');?>" style="font-size:12px;color:yellow;"><?php echo $this->language('换个帐号');?></a>
			<?php } else { ?>
			<label for="author"><?php echo $this->language('网名')?></label>
			<?php echo $this->form()->text('author', $this->language('网友') . rand(100,999), array('max-length' => 20));?>
			<?php } ?>
		</li>
		<li class="text">
			<label for="comment"><?php echo $this->language('评论内容')?></label>
			<div class="message">
				<p id="comment-quote">
					<strong class="yellow"><?php echo $this->language('回复')?>: </strong>
					<em></em>
					<code><a href="#close" title="cancel reply." onclick="return comment.unreply();">&times;</a></code>
				</p>
				<textarea cols="70" rows="4" name="message"></textarea>
			</div>
		</li>
		<li class="bar">
			<label>&nbsp;</label>
			<button type="submit" name="submit" value="submit" id="commentButton"><?php echo $this->language('提交');?></button>
			<button type="reset" name="reset" value="reset"><?php echo $this->language('重置');?></button>
			<span><?php echo $this->language('按下 Ctrl+Enter 或  Alt+S 键即可快速提交评论');?>.</span>
		</li>
	</ul>
	<div class="clear"></div>
</div>
</form>
<div class="msg commentMsg"><div class="bd"><i></i><code><a href="#close">&times;</a></code><h3>message</h3></div></div>

